home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
002
/
pcspel2.arc
/
SORTDIC.BAS
< prev
next >
Wrap
BASIC Source File
|
1984-10-25
|
1KB
|
42 lines
10 ON ERROR GOTO 260
20 KILL"qwertyui"
30 NAME "dictiona" AS "qwertyui"
40 ON ERROR GOTO 280
50 OPEN "qwertyui" FOR INPUT AS #1
60 OPEN "update" FOR INPUT AS #2
70 OPEN "dictiona" FOR OUTPUT AS #3
80 INPUT #1,DIC$:INPUT #2,M$
90 REM start main loop
100 IF M$<DIC$ THEN 190
110 REM dictionary word is smaller
120 PRINT #3,DIC$:W=W+1
130 I=1:PRINT "D";:INPUT #1,DIC$
140 IF M$>DIC$ THEN 120
150 PRINT #3,M$:W=W+1
160 I=2:PRINT "m";:INPUT #2,M$
170 GOTO 100
180 REM merge word is smaller
190 PRINT #3,M$:W=W+1
200 I=2:INPUT #2,M$:PRINT "M";
210 IF DIC$>M$ THEN 190
220 I=1:PRINT "d";:PRINT #3,DIC$:W=W+1
230 INPUT #1,DIC$
240 GOTO 100
250 END
260 PRINT ERR,ERL:RESUME NEXT
270 REM end of one of the files
280 PRINT "finishing ...";:IF I=2 THEN 370
290 REM dictionary ran out of words
300 WHILE NOT EOF(2)
310 PRINT #3,M$:W=W+1
320 INPUT #2,M$
330 WEND:RESET
340 PRINT "the dictionary now consists of";W;"words"
350 KILL"update":END
360 REM merge file ran out
370 WHILE NOT EOF(1)
380 PRINT #3,DIC$:W=W+1
390 INPUT #1,DIC$
400 WEND:RESET
410 GOTO 340